﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using IndicoInterface;
using DTBuilderLib;

namespace DownloadMeetingToDisplay
{
    class Program
    {
        /// <summary>
        /// Mainly a test program built to download a meeting and put it in the right
        /// place to be shown by our simple display test program.
        /// 
        /// Assumptions are made about the working directory of this guy
        /// to get the solution directory. Also the names of the various projects
        /// and, finally, the layout of everything. SOOOO this is a very fragile test
        /// program!!
        /// </summary>
        /// <param name="args"></param>
        static void Main(string[] args)
        {
            /// What conferece ID are we going to fetch?
            int conference_id = 14475;
 
            /// Where the heck are we located?
            DirectoryInfo solutionDir = new DirectoryInfo("..\\..\\..");

            /// Downlaod the meeting and turn it into jpegs.
            AgendaInfo a = new AgendaInfo(conference_id);
            JobDownloader jd = new JobDownloader();

            Console.WriteLine("Downloading agenda and talks");
            var meeting = jd.DownloadMeeting(a.GetNormalizedConferenceData());
            JPEGRender rend = new JPEGRender();
            Console.WriteLine("Rendering talks to jpegs");
            var talkjpegs = rend.RenderMeeting(meeting);

            /// Layout the meeting
            LayoutBuilder bld = new LayoutBuilder();
            var layout = bld.BuildVisualTreeForAMeeting(meeting, talkjpegs);

            /// Next, now that it is down, turn it into a Zeep Zoom guy. Make sure it builds it in-place.
            DeepZoomBuilder dz = new DeepZoomBuilder();
            dz.BuildDirectory = solutionDir.FullName + "\\DisplayBuiltTalk\\ClientBin";
            Console.WriteLine("Rendering jpegs to deepzoom images");
            DirectoryInfo dir = dz.RenderVisual("test", layout);
            Console.WriteLine("Directory of the info files is as follows: " + dir.FullName);
#if false
            DirectoryInfo dir = bld.RenderMeeting(meeting, talkjpegs);
            Console.WriteLine("Directory of the info files is as follows: " + dir.FullName);
#endif
        }
    }
}
